package com.lovo.service;

import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lovo.dao.BreakageMapper;
import com.lovo.dao.GoodsMapper;
import com.lovo.util.NumCode;
import com.lovo.vo.Injury_record;
import com.lovo.vo.Res_injury_goods;
import com.lovo.vo.Sec_Dept;

@Service
@Transactional
public class BreakageService {
	@Autowired
	BreakageMapper breakage;
	String id = null;

	public List<Injury_record> findByCondition(Injury_record condition) {
		List<Injury_record> list = breakage.findByCondition(condition);
		return list;

	}

	public int addBreakage(Injury_record condition) {
		condition.setId(getUUID());
		condition.setCode(NumCode.getCode());
		id = condition.getId();
		return breakage.addBreakage(condition);

	}

	public String getUUID() {
		String uuid = UUID.randomUUID().toString();
		return uuid;
	}

	public int findTotalCount(Injury_record condition) {
		return breakage.findTotalCount(condition);

	}

	public String getMoney(String id) {
		return breakage.getMoney(id);
	}

	public int updateSum(Injury_record condition) {
		return breakage.updateSum(condition);

	}

	public int updateStatus(Injury_record condition) {
		return breakage.updateStatus(condition);

	};

	public int deleteByid(String[] abc) {
		return breakage.deleteByid(abc);
	}

	public Injury_record findById(String id) {
		return breakage.findById(id);

	}

	public int insertres(Res_injury_goods condition) {
		condition.setId(getUUID());
		condition.setInjury_record_id(id);
		return breakage.insertres(condition);

	}

	public Res_injury_goods findBySid(String rid) {
		return breakage.findBySid(rid);

	}

	public Res_injury_goods findByRid(String rid) {
		return breakage.findByRid(rid);

	}

	public int updatecountsum(Res_injury_goods condition) {
		return breakage.updatecountsum(condition);
	}
	public Sec_Dept findDeptParentByUserid(String uid){
		return breakage.findDeptParentByUserid(uid);
		
	}

}
